const Sequelize = require('sequelize')
const CONFIG = require('./config')
const db = new Sequelize(
  CONFIG.MYSQL.database,
  CONFIG.MYSQL.username,
  CONFIG.MYSQL.password,
  {
    host: CONFIG.MYSQL.host,
    logging: CONFIG.DEBUG ? console.log : false,
    //方言
    dialect: 'mysql',
    pool: {
      max: 10,
      min: 0,
      idle: 10000,
    },
    timezone: '+08:00',
  }
)

module.exports = db
